package com.bsj.power.common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bsj.power.common.def.dto.personnel.PersonnelSearchDTO;
import com.bsj.power.common.def.entity.job.JobPersonnel;
import com.bsj.power.common.def.entity.job.WorkPersonnel;
import com.bsj.power.common.def.entity.personnel.Personnel;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author LiJiaXin
 * @version 1.0.0
 * @description JobPersonnelMapper
 * @time 2024/5/9 10:43
 */
public interface JobPersonnelMapper extends BaseMapper<JobPersonnel> {

    /**
     * 根据人员id获取当前作业集
     *
     * @param personnelSearchDTO
     * @return java.util.List<java.lang.Long>
     * @author ljx
     * @time 2024/5/9 11:28
     */
    List<Long> getPresentJob(PersonnelSearchDTO personnelSearchDTO);

    /**
     * 批量新增
     * @param map
     * @return
     */
    int batchInserts(Map<String, Object> map);

    /**
     * 根据作业工单获取作业人员信息
     * @param jobId
     * @return
     */
    List<WorkPersonnel> selectJobIdByPersonnelList(Long jobId);

    /**
     * 批量添加工单与负责人关系
     *
     * @param jobPersonnelList
     * @return java.lang.Integer
     * @author ljx
     * @time 2024/7/16 21:04
     */
    Integer batchAdd(@Param("jobPersonnelList") List<JobPersonnel> jobPersonnelList);

    /**
     * 根据多个作业的id查询所有的工作人员id
     * @param jobIds
     * @return
     */
    List<Integer> selectPersonnelsByJobIds(@Param("list") List<Long> jobIds);

    /**
     * 根据人员id查询最新绑定的工单id
     *
     * @param personnelId
     * @return java.lang.Integer
     * @author ljx
     * @time 2024/8/28 23:38
     */
    Integer getLastJobIdByPersonnelId(Integer personnelId);
}
